<template>
  <div>
    <Dog
      :imgurl="item.dogImgUrl"
      v-for="(item, index) in list"
      :key="index"
      :name="item.dogName"
      @addfn="addfn"
    ></Dog>
    <span>您喜欢的狗狗有</span>
    <ul>
      <li v-for="(item, index) in newarr" :key="index">{{ item }}</li>
    </ul>
  </div>
</template>

<script>
import Dog from "./components/dog4";
export default {
  components: {
    Dog,
  },
  data() {
    return {
      newarr: [],
      list: [
        {
          dogImgUrl:
            "http://nwzimg.wezhan.cn/contents/sitefiles2029/10146688/images/21129958.jpg",
          dogName: "博美",
        },
        {
          dogImgUrl:
            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2967740259,1518632757&fm=26&gp=0.jpg",
          dogName: "金毛",
        },
        {
          dogImgUrl:
            "https://pic1.zhimg.com/80/v2-7ba4342e6fedb9c5f3726eb0888867da_1440w.jpg?source=1940ef5c",
          dogName: "哈士奇",
        },
      ],
    };
  },
  methods: {
    addfn(name) {
      this.newarr.push(name);
    },
  },
};
</script>

<style>
</style>